/*
 * PageTitled.java
 *
 * Generic www titled page
 * Include title Label
 */

package net.kernub.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.Label;

import net.kernub.client.Page;

/*
 * Page class
 */
public class PageTitled extends Page
{
	private static boolean isInitialize = false;

	private static final Label titleLabel = new Label();

	private wwwConstants wwwConstants = GWT.create( wwwConstants.class );
	private String currentStyle = "PageTitled_BigTitle"; // PageTitled_Small

	public PageTitled()
	{
		if( isInitialize ) return;

		final DockPanel dock = new DockPanel();
	
		//titleLabel.setText( wwwConstants.mainTitleTxt() );
		titleLabel.setText( "" );
		titleLabel.addStyleName( currentStyle );
		titleLabel.setWidth( "auto" );

		dock.add( titleLabel, DockPanel.WEST );
		dock.setCellHorizontalAlignment( titleLabel, DockPanel.ALIGN_LEFT );

		this.addPagePart( dock );

		isInitialize = true;

		//GWT.log( "PageTitled::PageTitled() initialized", null );
	}

	public void setBigTitle( String title )
	{
		titleLabel.removeStyleName( currentStyle );
		currentStyle = "PageTitled_BigTitle";
		titleLabel.addStyleName( currentStyle );
		titleLabel.setText( title );
	}

	public void setSmallTitle( String title )
	{
		titleLabel.removeStyleName( currentStyle );
		currentStyle = "PageTitled_SmallTitle";
		titleLabel.addStyleName( currentStyle );
		titleLabel.setText( title );
	}

}

